<?php
    class category_index_controller extends controllerBase
    {
        public function process()
        {
            if(isset($_POST['val']))
            {
                $aVals = $_POST['val'];
                if(isset($aVals['id']) && count($aVals['id']))
                {
                    foreach($aVals['id'] as $iId)
                    {
                        if($iId)
                        {
                            $this->database->delete('category','category_id = '.(int)$iId);
                        }
                    }
                    return $this->url->getLink('admin/category',true,'Xóa danh mục thành công.');
                }
            }
            $aDatas = $this->database->getListObject('SELECT * FROM category');
            $this->set(array('aDatas' => $aDatas));
        }
    }
?>
